<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>提现</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../../css/mui.picker.min.css" />
		
		
		<style>
			h5 {
				margin: 5px 7px;
			}
			[v-cloak] {
			  display: none;
			}
			
					
			.mui-input-row .mui-btn {
			    line-height: 1.1;
			    float: right;
			    width:55%;
			    padding: 10px 15px;
			}
			
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">提现</h1>
		</header>
		<div class="mui-content">
			<div class="mui-content-padded" style="margin: 5px;">
				
				<form class="mui-input-group" id="fmInput">
					<div class="mui-input-row" v-cloak>
						<label>可提现额度:</label>
						<label>{{fmCash.cashamount}}</label>
					</div>
					<div class="mui-input-row">
						<label>支付宝账号:</label>
						<input type="text" placeholder="请输入" id="txtPayAct" v-model="fmCash.PayAct" maxlength="100"/>
					</div>
					<div class="mui-input-row">
						<label>真实名称:</label>
						<input type="text" placeholder="请输入" id="txtPayRealName" v-model="fmCash.PayRealName" maxlength="50"/>
					</div>
					
					<div class="mui-input-row">
						<label>提取金额:</label>
						<input type="number" placeholder="请输入" id="txtCash" v-model="fmCash.cash" maxlength="10"/>
					</div>
					
					
					
					<div class="mui-button-row">
						<button type="button" id="butSave" class="mui-btn mui-btn-primary" >确认</button>&nbsp;&nbsp;
						<button type="button" id="butCancel" class="mui-btn mui-btn-danger" >取消</button>
					</div>
					
				</form>
				
				
			</div>
		</div>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/vue.min.js"></script>
		<script src="../../js/tools.js"></script>
		<script>
			var theVue;
			
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});
			
			(function($) {
				$.init();
				//var result = $('#result')[0];
				
				
			})(mui);
			
			document.getElementById("butCancel").addEventListener('tap', function(e) 
			{
				mui.back();
			});
			
					
			
			document.getElementById("butSave").addEventListener('tap', function(e) 
			{
				//alert(theVue.fmWorkshop.state);
				
				//return;
				
				if(theVue.fmCash.PayAct.trim() == "")
				{
					mui.toast("请输入支付宝账号");
					return;
				}
				
				if(theVue.fmCash.PayRealName.trim() == "")
				{
					mui.toast("请输入正确真实名称");
					return;
				}
				
				if((!isNumber(theVue.fmCash.cash)))
				{
					mui.toast("请输入正确提现金额");
					return;
				}
				else
				{
					if(theVue.fmCash.cash < 0.10)
					{
						mui.toast("提现金额必须大于0.10");
						return;
					}
					
					if(theVue.fmCash.cash > theVue.fmCash.cashamount)
					{
						mui.toast("提现金额必须小于"+theVue.fmCash.cashamount);
						return;
					}
				}
				
				sespost('/zdm/AppApi/Merchant/MerchantGetCash',
				theVue.fmCash,
				function(retData)
				{
					switch(retData.stat)
					{
						case 1:
							loadData();
							mui.toast("提现成功");
							break;
							
						case 0:
							mui.toast("提现失败");
							break;
							
						case 2:
							mui.toast("取现超额");
							break;	
							
						case 3:
							mui.toast("取现金额不能小于0.10");
							break;
					}
					
				});
				
				
			});


		</script>
		
		<script>
		theVue = new Vue({
		    el:'#fmInput',
		    data:
		    {
			    fmCash:
			    {
//					PayAct:"",
//					PayRealName:"",
//					cash:0.10
				}
				
		    }
		    
		});
		
	function loadData()
	{
		sespost('/zdm/AppApi/Merchant/GetMerTotalInfo',
		{},
		function(retData)
		{
			retData.PayAct = "";
			retData.PayRealName = "";
			retData.cash = "0.10";
			theVue.fmCash = retData;
		});
	}	
	
	loadData();
		</script>
		
			
	</body>

</html>